<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<ui:composition template="/template.xhtml">
	<ui:define name="center">
		<h:form>
			<p:schedule value="#{scheduleController.eventModel}" editable="true"
				resizable="false" draggable="false" 
				widgetVar="myschedule"
				eventSelectListener="#{scheduleController.onEventSelect}"
				dateSelectListener="#{scheduleController.onDateSelect}"
				onEventMoveUpdate="messages" onEventResizeUpdate="messages"
				onDateSelectUpdate="eventDetails"
				onDateSelectComplete="eventDialog.show()"
				onEventSelectUpdate="eventDetails"
				onEventSelectComplete="eventDialog.show()">

			</p:schedule>

			<p:dialog widgetVar="eventDialog" header="Novo Evento"
				showEffect="clip" hideEffect="clip" width="350">
				<h:panelGrid id="eventDetails" columns="2">
					<h:outputLabel for="title" value="Titulo:" />
					<p:inputText id="title" value="#{scheduleController.event.title}" />

					<h:outputLabel for="from" value="De:" />
					<p:inputMask id="from" mask="99/99/9999"
						value="#{scheduleController.event.startDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" />
					</p:inputMask>

					<h:outputLabel for="to" value="Até:" />
					<p:inputMask id="to" mask="99/99/9999"
						value="#{scheduleController.event.endDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" />
					</p:inputMask>
					<h:outputLabel value="Inicio" for="hI" />
					<p:inputMask id="hI" mask="99:99" size="4"
						value="#{scheduleController.horaStart}">
						<f:convertDateTime pattern="HH:mm" />
					</p:inputMask>
					<h:outputLabel value="Fim" for="hE" />
					<p:inputMask id="hE" mask="99:99" size="4"
						value="#{scheduleController.horaEnd}">
						<f:convertDateTime pattern="HH:mm" />
					</p:inputMask>
					<h:outputLabel for="allDay" value="Dia todo:" />
					<h:selectBooleanCheckbox id="allDay"
						value="#{scheduleController.event.allDay}" />
				</h:panelGrid>
				<h:panelGrid columns="3">
					<p:commandButton type="reset" value="Reset" />
					<p:commandButton value="Salvar"
						oncomplete="myschedule.update();eventDialog.hide();"
						actionListener="#{scheduleController.addEvent}" />
					<p:commandButton value="excluir" oncomplete="myschedule.update();eventDialog.hide();"
						actionListener="#{scheduleController.delEvent}"/>
				</h:panelGrid>
			</p:dialog>
		</h:form>
	</ui:define>
</ui:composition>
</html>